
<!--{template admin/header}-->
<script src="static/js/date/WdatePicker.js" type="text/javascript"></script>
<script src="static/js/topicManage.js" type="text/javascript"></script>
<form action="admin.php?mod=mall&code=search_order" method="POST" name="search">
	<table cellspacing="1" cellpadding="4" width="100%" align="center" class="tableborder">
		<tr class="header">
			<td colspan="15">搜索订单</td>
		</tr>
		<tr>
                    <td class="altbg1">下单时间:</td>
                    <td class="altbg2">
                        <input type="text" id="timefrom" name="timefrom" value="{$timefrom}" readonly onFocus="WdatePicker({startDate: '%y-%M-%d 00:00:00', dateFmt: 'yyyy-MM-dd HH:mm', alwaysUseStartDate: true})"/>
                        &nbsp;&nbsp;至&nbsp;&nbsp;
                        <input type="text" id="timeto" name="timeto" value="{$timeto}" readonly onFocus="var fromt = document.getElementById('timefrom').value;
                                WdatePicker({startDate: '%y-%M-%d 00:00:00', dateFmt: 'yyyy-MM-dd HH:mm', alwaysUseStartDate: true, minDate: fromt})"/>
                    </td>
                    <td class="altbg1">商品名称:</td>
                    <td class="altbg2"><input type="text" name="goods_name" value="{$goods_info['name']}" size="20"></td>
                    <td class="altbg1">商户订单号:</td>
                    <td class="altbg2"><input type="text" name="ordersid" value="{$ordersid}" size="20"></td>
                    <td class="altbg1">订单号:</td>
                    <td class="altbg2"><input type="text" name="sn" value="{$sn}" size="20"></td>
                </tr>
                <tr>
                    <td class="altbg1">用户呢称:</td>
                    <td class="altbg2"><input type="text" name="user_nickname" value="{$user_nickname}" size="20"></td>
                    <td class="altbg1">商品类型:</td>
                    <td class="altbg2">
                        <select name="goods_style">
                                <option value="">请选择</option>
                                <option value="entity" {if $goods_style == 'entity'}selected="selected"{/if}>实体物品</option>
                                <option value="fictitious" {if $goods_style == 'fictitious'}selected="selected"{/if}>虚拟物品</option>
                        </select>
                    </td>
                    <td class="altbg1">订单状态:</td>
                    <td class="altbg2">
                        <select name="order_state">
                                <option value="-1">请选择</option>
                                <option value="0" {if $order_status == 0}selected="selected"{/if}>未支付</option>
                                <option value="1" {if $order_status == 1}selected="selected"{/if}>已支付</option>
                                <option value="2" {if $order_status == 2}selected="selected"{/if}>已发货</option>
                                <option value="2" {if $order_status == 3}selected="selected"{/if}>已退还</option>
                        </select>
                    </td>
                    <td class="altbg1"><button name="do" value='search' type="submit" class="button">搜索一下</button></td>
                    <td class="altbg2"><button name="do" value='order_export' type="submit" class="button">订单导出</button></td>
                        <!--<td class="altbg1"><button name="do" value='order_mall_export' type="submit" class="button">订单详情导出</button></td>-->
		</tr>
	</table>
</form>
<form action="admin.php?mod=mall&code=express_import" method="POST" enctype="multipart/form-data" id="uploadForm">
    <table cellspacing="1" cellpadding="4" width="50%" align="center" class="tableborder" style="display: inline-block;">
        <tr>
            <td class="altbg1">物流更新:</td>
            <td class="altbg2"><input type="file" name="file" /> </td>
            <td class="altbg1"><button name="do" value='search' type="submit" class="button">上传</button></td>
        </tr>
    </table>
</form>
<table cellspacing="1" cellpadding="4" width="100%" align="center" class="tableborder">
<tr class="header">
	<td width="10%">商户订单号</td>
	<td width="10%">订单号</td>
	<td width="10%">商品名称</td>
	<td width="5%">商品类型</td>
	<td width="5%">用户呢称</td>
	<td width="5%">数量</td>
	<td width="10%">用户地址</td>
	<td width="10%">用户手机</td>
	<td width="10%">订单状态</td>
	<td width="10%">订单时间</td>
	<td>订单状态</td>
</tr>

<!--{loop $list['list'] $one}-->
<tr class="altbg1" id="tr_id_{$one['id']}">

	<td>{$one[ordersid]}</td>
        <td>{$one[sn]}</td>
	<td>{$one['goods_name']}</td>
	<td>{$goods_type[$one['goods_style']]}</td>
	<td>{$one['username']}</td>
	<td>{$one['goods_num']}</td>
	<td>{$one['receiver_state']}{$one['receiver_city']}{$one['receiver_district']}{$one['address']}</td>
	<td>{$one['mobile']} {$one['tel']}</td>
	<td>{$pay_status[$one['status']]}</td>
	<td>{$one['add_time']}</td>
	<td>
		<!--"data[{$one['id']}]-->
                {if $one['status'] == 0}
                {elseif $one['status'] == 1}
		<button value="" data-oid="{$one['ordersid']}" name="fahuo" onclick="fahuo(this)">发货</button>
		<button value="" data-id="{$one['id']}" name="tuihuan" onclick="tuihuan(this)">退还</button>
		{elseif $one['status'] == 2}
		<button value="" data-id="{$one['id']}" name="tuihuan" onclick="tuihuan(this)">退还</button>
		{else}
		订单已取消
		{/if}
                <a href="admin.php?mod=mall&code=order_detail&id={$one['id']}">详情</a>
	</td>

</tr>
<!--{/loop}-->

</table>

{$list['page']['html']}
<script type="text/javascript">
	
	function fahuo(obj){
            
            var oid = $(obj).attr("data-oid");
            showDialog('delivergoods', 'ajax', '发货', {url:'ajax.php?mod=mall&code=delivergoods&oid='+oid}, 400);
            return false;
            $.get("ajax.php?mod=mall&code=ordership",{'oid':oid},function(json){
                    if(json.done){
                            alert(json.msg);
                            window.location.reload();
                    }else{
                            alert(json.msg);
                    }
            },'json');
	}

	function tuihuan(obj){
            var oid = $(obj).attr("data-id");

            $.get("ajax.php?mod=mall&code=ordercancle",{'oid':oid},function(json){
                    if(json.done){
                            alert(json.msg);
                            window.location.reload(); 
                    }else{
                            alert(json.msg);
                    }
            },'json');
	}
        
</script>




